﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             x:Class="Chapters.OpacityMaskAndClip"
             x:Name="UserControl"
             d:DesignWidth="640"
             d:DesignHeight="480">

    <UniformGrid x:Name="LayoutRoot"
                 Rows="2" Columns="2" >
        <Image Source="/Resources;;;component\Shared\toucan.jpg"
               Width="300">
            <Image.OpacityMask>
                <RadialGradientBrush RadiusX="75"
                                     RadiusY="75"
                                     MappingMode="Absolute"
                                     GradientOrigin="150,100"
                                     Center="150,100">
                    <GradientStop Color="White"
                                  Offset="0" />
                    <GradientStop Color="Transparent"
                                  Offset="1" />
                </RadialGradientBrush>
            </Image.OpacityMask>
        </Image>
        <Image Source="/Resources;;;component\Shared\toucan.jpg"
               Width="300">
            <Image.Clip>
                <EllipseGeometry RadiusX="75"
                                 RadiusY="75"
                                 Center="150,100" />
            </Image.Clip>
        </Image>

        <TextBlock FontWeight="Bold" HorizontalAlignment="Center">With OpacityMask</TextBlock>
        <TextBlock FontWeight="Bold" HorizontalAlignment="Center">With Clip geometry</TextBlock>
    </UniformGrid>
</UserControl>